class Api::StoreAdjustSalaryLogsController < Api::BaseController
  before_action :set_staff
  def create
    @status = AdjustSalaryService.call(@staff, store_adjust_salary_log_params)
    if @status.success?
      render json: {status: true, basic: params[:basic]}
    else
      render json: {status: false, message: @status.message }
    end
  end

  private
  def store_adjust_salary_log_params
    params[:creator_id] = current_user.id
    params[:started_at] = params[:started_at].gsub("-","")
    params.permit(:basic, :reason, :started_at, :store_staff_id, :creator_id)
  end

  def set_staff
    @staff = StoreStaff.find(params[:store_staff_id])
  end
end
